Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Common static analysis issues #35

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

knutwannheden
Copy link
Contributor

@knutwannheden knutwannheden merged commit 6cfbf8f into main Oct 21, 2023
@timtebeek timtebeek deleted the refactor/common-static-analysis-issues-2 branch October 27, 2023 22:28
Copy link
Contributor

@JLLeitschuh JLLeitschuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some concerns

Comment on lines -356 to -369
switch (_case.getType()) {
case Statement:
if (_case.getStatements().isEmpty()) {
// Visit a fake empty statement to ensure that the ConditionNode has a true successor
visit(new J.Empty(randomId(), Space.EMPTY, Markers.EMPTY), p);
} else {
visitStatementList(_case.getStatements(), p);
}
break;
case Rule:
visit(_case.getBody(), p);
breakFlow.add(currentAsBasicBlock());
current = Collections.emptySet();
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on why what you have is better?

@knutwannheden
Copy link
Contributor Author

@JLLeitschuh Thanks for your review! I ran a recipe which did all these changes. The switch-to-if is due to https://docs.openrewrite.org/recipes/staticanalysis/minimumswitchcases (RSPEC-1301). Not sure I agree with that particular one either...

The lost comments are deficiencies of the respective recipes. I can try to fix these.

@JLLeitschuh
Copy link
Contributor

The lost comments are deficiencies of the respective recipes. I can try to fix these.

Much appreciated. Can you also restore the lost comments in the meantime?

@knutwannheden
Copy link
Contributor Author

Much appreciated. Can you also restore the lost comments in the meantime?

112b76e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants